package com.yan.demo.arrydemo;

import java.util.Arrays;

public class ArrayTest8 {
    public static void main(String[] args) {
        int[] arr = {3, 14, 2, 7, 45, 3, 89};
        int[] arr1 = new int[7];
        int l = arr.length - 1, f = 0;
        for (int i = 0; i < arr.length; i++) {
            if (arr[i] % 2 == 0) {
                arr1[l--] = arr[i];
            } else {
                arr1[f++] = arr[i];
            }
        }
        System.out.println(Arrays.toString(arr1));
    }
}
